<?php 
session_start();
include "conexao.php";

$email = $_POST['email'];
$senha = $_POST['senha'];

$email = addslashes($email);
$senha = addslashes($senha);

$select = "SELECT u.usid, u.usname FROM usuarios u WHERE u.usemail = '$email' and u.ussenha = '$senha'";
$res = mysql_query($select);

$user = mysql_fetch_array($res);

if($user != false){
	$_SESSION['id'] = $user['usid'];
	$nome = stripslashes($user['usname']);
	$_SESSION['nome'] = $nome;
	echo "0";
	return 1;
}else{
	echo "1";
}

?>